<?php
class CmsLanguageModel extends ModelArray
{
	protected static $instance;

	public static function GetInstance()
	{
        return self::$instance ? self::$instance : self::$instance = new CmsLanguageModel();
	}

    protected function LoadFields()
    {
        $this->AddField('id', 'varchar', false, true);
        $this->AddField('name');
        $this->AddField('origin_name');
        $this->AddField('enabled', 'bool');
    }

	public function GetName($id)
	{
		return $this->FindScalarById($id, 'name');
	}

	protected function GetDefault()
	{
		return $this->FindById(AppConfig::GetInstance()->DEFAULT_LANGUAGE);
	}
}
?>
